//ZBRUSH MACRO - Recorded in ZBrush version 4.5
[IButton,???,"Reset Tool palette to remove all but the selected 3D tool",
  [IShowActions,0]
  [IConfig,4.5]
  //check if there's a 3D tool in Edit mode
  [If,[IsEnabled,Transform:Edit],
  	[If,[IGet,Transform:Edit],,		
  		[Exit]
		]
	,				
  	[Exit]
  ]	
  //ask to save the tool
  [VarSet,toolName,[GetActiveToolPath]]
  [VarSet,toolName,[StrMerge,toolName,".ztl"]]
  [VarSet,toolName,[FileNameAsk,"ZTool(*.ztl)|*.ztl||",#toolname ,"Please Save File..."]]
  //if there's a valid file name
  [If,[StrLength,toolName],
    [VarSet,toolName,[StrMerge,[FileNameExtract,toolName,3],".ztl"]]
    //get the transform values
    [MemDelete,MC_ToolReset]
    [MVarDef,MC_ToolReset,9,0]
    [MTransformGet,MC_ToolReset,0]
    //save the tool
    [FileNameSetNext,toolName]
    [IPress,Tool:Save As]
    //save the material
    [VarSet,tmpMat,[IGet,Material:Item Info]]   
    [IKeyPress,13,[IReset,3]]//reset tools
    //clear the canvas and reload and redraw the tool
    [IPress,Layer:Clear]
    [FileNameSetNext,toolName]
    [IPress,Tool:Load Tool]
    [ISet,Material:Item Info,#tmpMat]
    [IClick,1004,10,10,10,20]
    //reset transform values
    [MTransformSet,MC_ToolReset,0]
    [IPress,Transform:Edit]
  ]		
]//end of macro
